const fs = require('fs');

// 动态路由
const useRoutes = (app) => {
  fs.readdirSync(__dirname).forEach((file) => {
    if (file === "index.js") return;  // 跳过当前文件
    const router = require(`./${file}`);
    app.use(router.routes());
    app.use(router.allowedMethods());
  })
}

module.exports = useRoutes;
